import Vue from 'vue';
import VueRouter from 'vue-router';
import Index from '../views/Index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'index',
    component: Index,
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue'),
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue'),
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/Mine.vue'),
  },
  {
    path: '/product/:lid',
    name: 'product',
    component: () => import('../views/Product.vue'),
  },
  {
    path: '/cart/:uid',
    name: 'cart',
    component: () => import('../views/Cart.vue'),
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('../views/Order.vue'),
  },
  {
    path: '/address/:uid',
    name: 'address',
    component: () => import('../views/Address.vue'),
  },
  {
    path: '/addaddress',
    name: 'addaddress',
    component: () => import('../views/Addaddress.vue'),
  },
  {
    path: '/paysuccess',
    name: 'paysuccess',
    component: () => import('../views/Paysuccess.vue'),
  },
  {
    path: '/orderlist/:uid',
    name: 'orderlist',
    component: () => import('../views/Orderlist.vue'),
  },
  {
    path: '/fication',
    name: 'fication',
    component: () => import('../views/Fication.vue'),
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/Search.vue'),
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
